module.exports = () => {
  return {
    name: "configure-server",
    configureServer(server) {
      server.middlewares.use((req, res, next) => {
        // 自定义请求处理...
        console.log(req.url);
        if (req.url === "/api/user") {
          res.setHeader("Content-Type", "application/json");
          res.end(
            JSON.stringify({
              msg: "hello world",
            })
          );
        } else {
          next();
        }
      });
    },
  };
};
